package com.gisocn.onemap.ui.dialog;

import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.fragment.app.DialogFragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import com.gisocn.onemap.model.AboutSoftware;
import com.gisocn.onemap.model.VersionLog;
import com.gisocn.onemap.sgzx.R;
import com.gisocn.onemap.utils.Utils;
import java.util.Iterator;

/* loaded from: classes2.dex */
public class AboutSoftwareDialog extends DialogFragment {
    AboutSoftware aboutSoftware;
    private Context context;
    @BindView(R.id.tv_close)
    TextView tvClose;
    @BindView(R.id.tv_content)
    TextView tvContent;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_titles)
    TextView tvTitles;
    @BindView(R.id.tv_version)
    TextView tvVersion;
    Unbinder unbinder;
    VersionLog versionLog;
    private String title = "";
    private String content = "";

    @Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setCancelable(false);
        setStyle(0, 16974397);
    }

    @Override // androidx.fragment.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        VersionLog versionLog;
        View inflate = layoutInflater.inflate(R.layout.dialog_about_software, viewGroup, false);
        this.unbinder = ButterKnife.bind(this, inflate);
        this.tvTitle.setText(R.string.about_software);
        this.tvTitles.setTypeface(Typeface.defaultFromStyle(1));
        this.tvTitle.setTypeface(Typeface.defaultFromStyle(1));
        this.tvTitles.setText(this.aboutSoftware.getTitle());
        this.tvContent.setText(this.aboutSoftware.getParagraph());
        if (this.context != null && (versionLog = this.versionLog) != null && versionLog.getVersionLog() != null) {
            String versionName = Utils.getVersionName(this.context);
            Iterator<VersionLog.Version> it = this.versionLog.getVersionLog().iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                VersionLog.Version next = it.next();
                if (versionName.equals(next.getVersionName())) {
                    TextView textView = this.tvVersion;
                    textView.setText("版本号: " + versionName + "(" + next.getVersionDate() + ")");
                    break;
                }
            }
        } else {
            this.tvVersion.setText("版本号: 1.1.7");
        }
        return inflate;
    }

    @Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
    public void onDestroyView() {
        super.onDestroyView();
        this.unbinder.unbind();
    }

    public void initData(AboutSoftware aboutSoftware, VersionLog versionLog, Context context) {
        this.aboutSoftware = aboutSoftware;
        this.versionLog = versionLog;
        this.context = context;
    }

    public void initData(String str, String str2) {
        this.title = str;
        this.content = str2;
    }

    @OnClick({R.id.tv_close})
    public void onViewClicked() {
        dismiss();
    }
}
